<?php
$query = mysql_query("SELECT * FROM news ORDER BY id desc LIMIT 5");
$id = $_GET['delete'];
if($check->isAdmin()) {
	if($_GET['delete']) {
		mysql_query("DELETE FROM news WHERE id='$id'") 
		or die(mysql_error());
		header("Location: ?page=start");
		exit;
		$main = 'You deleted news articel!';
	}
}
while ($row = mysql_fetch_assoc($query)) {
	$main .= '<h2>'.$row['title'].'</h2>
					
			'.$row['body'].'
					
			<p class="post-footer align-right">					
			<a href="#" class="readmore">Read more</a>
			<a href="?page=comments&id='.$row['id'].'" class="comments">Comments ('.$row['comments'].')</a>
			<span class="date">'.$row['date'].'</span>
			';if($check->isAdmin()) {
			$main .= '
			<a href="?page=start&delete='.$row['id'].'">[X]</a>';} $main .= '
			</p>
		';
}
?>